#!/usr/bin/env python3
import whois

def is_register(domain_name):
    try: 
        w = whois.whois(domain_name)
       
    except:
        return False
    else:
        return w.domain_name
def search_info(domain):
    data_info = whois.whois(domain)
    print("Domain name info is :",data_info)

if __name__ == "__main__":
    filename = "./aaa.txt"
    # domains_name = [
    #     "https://www.baidu.com",
    #     "mashibing.com",
    #     "asdasfgdadqwed.cn",
    #     "taobao.com"
    # ]
    #此处将上面的域名制作成一个文件夹打开名为aaa.txt
    with open(filename,"r",encoding = "utf-8")as file:
        lines = [line.strip() for line in file]
        for i in lines:
            result = is_register(i)
            print((i + " is true"  if result else i + "is false"))
            # if result:
            #     print(i + "is True")
            # else:
            #     print(i + "is False")
    domain_info = input("please input domain name :")
    search_info(domain_info)
